package org.jawp.persistence;

import java.util.LinkedList;
import java.util.List;

public class Order {

	// members
	private final int id;
	private int customerIdId;
	private final List<Product> products;
	private boolean validation;
	private boolean payment;
	
	// constructor
	public Order(int id, int customerId) {
		super();
		this.id = id;
		this.customerIdId = customerId;
		this.products = new LinkedList<Product>();
		this.validation = false;
		this.payment = false;
	}
	
	// getters

	public int getId() {
		return id;
	}

	public int getint() {
		return customerIdId;
	}

	public List<Product> getProducts() {
		return products;
	}

	public boolean isValidated() {
		return validation;
	}

	public boolean isPayed() {
		return payment;
	}
	
	// setters

	public void setint(int customerId) {
		this.customerIdId = customerId;
	}

	public void setAsValidated() {
		this.validation = true;
	}

	public void setAsPayed() {
		this.payment = true;
	}
	
	// generic methods
	
	@Override
	public String toString() {
		return "Order number "+id+" for "+customerIdId;
	}

	@Override
	public boolean equals(Object obj) {
		if( (obj instanceof Order) && (this.id == ((Order)obj).id))
			return true;
		return false;
	}
}
